package hhm.javamode.composite.duck;

/**
 * Created by Administrator on 2017/1/23.
 */
public class DuckSimulatorTest {

    public static void main(String[] args) {
        DuckSimulatorTest duckTest = new DuckSimulatorTest();
        duckTest.simulatortest();
    }

    void simulatortest() {
        Quackable mallQuackable = new MallardDuck();//定义绿头鸭
        Quackable reQuackable = new RedheadDuck();//定义红头鸭
        Quackable duckcall = new DuckCall();//定义鸭鸣器
        Quackable rubber = new RubberDuck();//定义橡皮鸭

        System.out.println("Test Ducksimulator");

        Duckquack(mallQuackable);
        Duckquack(reQuackable);
        Duckquack(duckcall);
        Duckquack(rubber);


        Quackable gooseDuck= new GooseAdapter(new Goose());
        gooseDuck.quack();
    }

    void Duckquack(Quackable duck) {
        duck.quack();
    }
}
